// eslint-check.js
const { ESLint } = require('eslint');

async function runESLint() {
  const eslint = new ESLint({
    overrideConfigFile: './.eslintrc.js', // 使用项目中的 ESLint 配置文件
    fix: true, // 自动修复可修复的错误
  });

  const files = ['src/views/report/fundUsage/fundUsage.vue']; // 指定要检查的文件路径

  try {
    const results = await eslint.lintFiles(files);
    results.forEach((result) => {
      console.log(result.filePath);
      result.messages.forEach((message) => {
        console.log(`${message.line}:${message.column} - ${message.message}`);
      });
    });
  } catch (error) {
    console.error('Error running ESLint:', error);
  }
}

runESLint();